using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class EntityAnimEventRecevier : MonoBehaviour
    {

        private EntityDriver entityDriver;
        private void Awake()
        {
            if (this.transform.parent != null)
            {
                entityDriver = this.transform.parent.GetComponent<EntityDriver>();
            }
        }

        /// <summary>
        /// 实体资源配置Id，用于之后的播放音效
        /// </summary>
        // public int entityResId;
        public void ActiveObject(int index)
        {
            if (entityDriver != null)
            {
                entityDriver.ActiveObject(index);
            }
        }

        public void DeactiveObject(int index)
        {
            if (entityDriver != null)
            {
                entityDriver.DeactiveObject(index);
            }
        }


        public void PlayAudio(int audioId)
        {
            if (entityDriver != null)
            {
                entityDriver.PlayAudio(audioId);
            }
        }

        public void PlayFootStep()
        {
            if (entityDriver != null)
            {
                entityDriver.PlayFootStep();
            }
        }
    }
}
